package com.ghn.cocknovel.ui.activity.work

import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.util.Log
import com.example.basemodel.base.BaseHeadVMActivity
import com.example.basemodel.base.DefaultHeadStyle
import com.ghn.cocknovel.R
import com.ghn.cocknovel.databinding.ActivityTaskDetailsBinding
import com.ghn.cocknovel.ui.activity.work.vm.WorkTasksViewModel

class TaskDetailsActivity : BaseHeadVMActivity<WorkTasksViewModel,ActivityTaskDetailsBinding, DefaultHeadStyle>() {
    override fun layoutId()=R.layout.activity_task_details

    override fun initView(savedInstanceState: Bundle?) {
        setHeadTitle("排班详情")
        mViewModel.squeryPassengerBySite(intent.getStringExtra("id").toString())
        mViewModel.msqueryPassengerBySite.observe(this){
            //任务
            mDatabind.DetailsId.text=it?.schedulePlanDetail?.taskId.toString()
            mDatabind.DetailsName.text=it?.schedulePlanDetail?.fenceAreaName
            mDatabind.DetailsSName.text=it?.schedulePlanDetail?.driverName
            mDatabind.DetailsCarNumber.text=it?.schedulePlanDetail?.carNumber
            mDatabind.DetailsCarCapacity.text=it?.schedulePlanDetail?.carCapacity.toString()
            mDatabind.DetailsSNumber.text=it?.schedulePlanDetail?.deviceNumber
            mDatabind.DetailsSdate.text=it?.schedulePlanDetail?.taskStartTime
            mDatabind.DetailsEdate.text=it?.schedulePlanDetail?.taskEndTime
            mDatabind.DetailsZmileage.text=it?.schedulePlanDetail?.mileage.toString()
            mDatabind.DetailsZdate.text=it?.schedulePlanDetail?.duration.toString()
            mDatabind.DetailsRsdate.text=it?.schedulePlanDetail?.goLiveTime
            mDatabind.DetailsRedate.text=it?.schedulePlanDetail?.offlineTime.toString()
            //订单
            mDatabind.DetailsZorderNumber.text=it?.taskOrderDetail?.soldNum.toString()
            mDatabind.DetailsYNumber.text=it?.taskOrderDetail?.finishSoldNum.toString()
            mDatabind.DetailsTNumber.text=it?.taskOrderDetail?.returnNum.toString()
            mDatabind.DetailsTrate.text=it?.taskOrderDetail?.finishRate.toString()+"%"
            mDatabind.DetailsWtrate.text=it?.taskOrderDetail?.returnRate.toString()+"%"
            mDatabind.DetailsCrnumber.text=it?.taskOrderDetail?.adultNum.toString()
            mDatabind.DetailsRnumber.text=it?.taskOrderDetail?.childrenNum.toString()
            mDatabind.DetailsZnunmber.text=it?.taskOrderDetail?.totalUserNum.toString()
            mDatabind.DetailsZamount.text="¥"+it?.taskOrderDetail?.totalAmount.toString()
            mDatabind.DetailsAverageRating.text=it?.taskOrderDetail?.avgScores.toString()+"分"

        }
    }


    override fun createObserver() {

    }
}